// pages/newsinformation/newsinformation.js
const app = getApp();
var ea = require('../../utils/each.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indexdd: 0,
    indexddd: 0,
    sousuo: app.data.imgurl + 'sou.png',
    medal: app.data.imgurl + "medal.png",// 奖牌
    rightarrow: app.data.imgurl + "rightarrow.png",  //右箭头
    lefttop: app.data.imgurl + "lefttop.png", //左上角
    zan: app.data.imgurl + "appreciate.png",
    yizan: app.data.imgurl + "hongxin.png",
    pinglun: app.data.imgurl + "comment.png",
    worksd: [
      { headsrc: app.data.imgurl + "headimg.png", appreciatesrc: app.data.imgurl + "appreciate.png", type: "0", src: app.data.imgurl + "2017123101.mp4", title: "来自炎炎夏日去大山里避暑的旅拍混剪", label: "#多媒体摄影", comment: "20", appreciate: "100", comments: [{ type: "0", fname: "胡杰", sname: "张飞", content: "消息不错" }] },
      { headsrc: app.data.imgurl + "headimg.png", appreciatesrc: app.data.imgurl + "appreciate.png", type: "1", src: [app.data.imgurl + "swiper1.png", app.data.imgurl + "swiper1.png"], title: "来自炎炎夏日去大山里避暑的旅拍混剪", label: "#多媒体摄影", comment: "20", appreciate: "100", comments: [{ type: "0", fname: "胡杰", sname: "张飞", content: "消息不错" }] }

    ],
    imgtypes: ["活动介绍", "比赛作品", "普通作品"],
    works: [
      { src: app.data.imgurl + "swiper.png", title: "2019“伯奇杯”中国创意摄影展活动", content: "为纪念中国近代科学先驱邹伯奇的重要贡献，弘扬培育邹伯奇“敢为人", browse: "50" },  // 浏览次数
      { src: app.data.imgurl + "swiper.png", title: "2019“伯奇杯”中国创意摄影展活动", content: "为纪念中国近代科学先驱邹伯奇的重要贡献，弘扬培育邹伯奇“敢为人", browse: "50" },
      { src: app.data.imgurl + "swiper.png", title: "2019“伯奇杯”中国创意摄影展活动", content: "为纪念中国近代科学先驱邹伯奇的重要贡献，弘扬培育邹伯奇“敢为人", browse: "50" },
      { src: app.data.imgurl + "swiper.png", title: "2019“伯奇杯”中国创意摄影展活动", content: "为纪念中国近代科学先驱邹伯奇的重要贡献，弘扬培育邹伯奇“敢为人", browse: "50" },
    ],
    rightarrow: app.data.imgurl + "rightarrow.png",  //右箭头
    fire: app.data.imgurl + "fire.png", // 火
    lefttop: app.data.imgurl + "lefttop.png", //左上角
    trophy: app.data.imgurl + "trophy.png",//奖杯
    frequnecy: app.data.imgurl + "worksnumbert.png",// 作品数量
    driedfood: ["摄影器材", "后期教程", "技术分享"],
    matchs: [
      { src: app.data.imgurl + "swiper.png", title: "2019自然风景展", reward: "2000元现金+证书", date: "8月14日 - 8月30日", frequnecy: "21314" },
      { src: app.data.imgurl + "swiper.png", title: "2018自然风景展", reward: "5000元现金+证书", date: "8月14日 - 8月30日", frequnecy: "21314" }
    ],
    sousuo: app.data.url +'sheyingjia/xzuoping1/sousuo',
    shuju:'',
    tiaojian:'',

  },
  //点击导航栏
  ssx: function (e) {
    console.log(e)
    var indexdd = e.currentTarget.dataset.index;
    this.setData({
      indexdd: indexdd
    })
  },
  //点击干货分享的 下面的导航标题
  qiehuan: function (e) {
    this.setData({
      indexddd: e.currentTarget.dataset.index
    })
  },
  // 活动详情
  toxqactivity: function (e) {
    console.log(e);
    var id = e.currentTarget.dataset.id;
    // return
    wx.navigateTo({
      url: '/pages/xqactivity/xqactivity?id='+id,
    })

  },
  //查看比赛详情
  toxamatch: function () {
    wx.navigateTo({
      url: '/pages/xqmatch/xqmatch',
    })
  },

  //干货分享
  todriedfood: function () {
    wx.navigateTo({
      url: '/pages/xqdriedfood/xqdriedfood',
    })
  },
//变更条件
changes:function(e){
  var str = e.detail.value;
  this.setData({ tiaojian:str});
  this.sousuo();
},
//搜索动作
  sousuo:function(){
    // console.log(e);
    var str = this.data.tiaojian;
    var user = wx.getStorageSync('user');
    var that = this;
    // console.log(str);
    ea.qinqiu(that.data.sousuo,{str:str,token:user.token},function(data){
      console.log(data);
      that.setData({shuju:data});
    })
  },
  //跳转到比赛作品
  toworksd:function(e){
   
    var id = e.currentTarget.dataset.id;
    // console.log(id);
    wx.navigateTo({
      url: '/pages/xqworks/xqworks?id='+id,
    })
  },
  toworksds:function(e){
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/pxqworks/pxqworks?id='+id,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.sousuo();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})